//
//  SQPlanViewController.m
//  energy
//
//  Created by 苏青 on 2021/9/30.
//

#import "SQPlanViewController.h"

#import "SQEmergencyPlanViewController.h"

#import "SQPlanModel.h"

@interface SQPlanViewController ()<BaseTableVCInterface>

@end

@implementation SQPlanViewController

- (void)viewDidLoad {
    self.tableViewInterface = self;
    [super viewDidLoad];
    self.navigationItem.title = @"应急预案";
    [self getPlanData];
    
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getReleaseData) name:@"addRelease" object:nil];
    
    self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        [self getPlanData];
    }];
    
    LC_WEAK_SELF
    self.cellEvent = ^(int key) {
        SQPlanModelData * dataModel = weakSelf.dataSouece[key];
        SQEmergencyPlanViewController * emergencyPlanVC = SQEmergencyPlanViewController.new;
        emergencyPlanVC.planModelData = dataModel;
        [weakSelf pushVC:emergencyPlanVC];
    };
}

-(void)getPlanData{
    [SQPlanModel getDataWithParams:@{@"ep_enterprise":MEnterpriseId} WithCallBack:^(SQPlanModel * data) {
        [self detailModelwithArr:data.data withCallBack:nil];
        [self reloadTableView];
        
    }];
}

-(BaseModel *)modelForCell:(NSIndexPath *)indexPath{
    return self.dataSouece[indexPath.row];
}



-(NSInteger)rowsCount:(NSInteger)section{
    return self.dataSouece.count;
}


- (NSArray<NSArray<NSString *> *> *)classArr{
    return @[@[@"SQPlanTableViewCell"]];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
